# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        博智科技  
# Name:         demo1732
# Description:
# Author:       yzl
# Date:         2019-02-08
#-------------------------------------------------------------------------------


import threading
from time import sleep,ctime

# fun003 依赖 fun001 fun002 结果
def fun001():
    pass

def fun002():
    pass

def fun003():
    pass

# 线程函数
def func(index,sec):
    print('开始执行',index,'执行时间',ctime())
    sleep(sec)
    print('执行结束', index, '结束时间', ctime())

# 普通对象对象
class Mythread:
    def __init__(self,func,args):
        self.func = func
        self.args = args

    # 重写 __call__ 方法
    def __call__(self):
        # 执行函数
        self.func(*self.args)

def main():
    # 线程1
    thread1 = threading.Thread(target=Mythread(func,args=(40,4)))
    thread1.start()

    # 线程2
    thread2 = threading.Thread(target=Mythread(func, args=(10, 2)))
    thread2.start()

    thread1.join()
    thread2.join()

    print("main is over")

if __name__ == '__main__':
    main()
